package com.pk.platform.business.charge.web;

import java.util.ArrayList;
import java.util.List;

import com.pk.platform.business.charge.service.IIncomeExpenseIndexService;
import com.pk.platform.business.core.web.GenericAction;
import com.pk.platform.business.data.service.IBaseDataService;
import com.pk.platform.domain.charge.IncomeExpenseIndex;
import com.pk.platform.domain.data.BaseData;
import com.pk.platform.util.constant.Constant;

public class IncomeExpenseIndexAction extends GenericAction {

	private IIncomeExpenseIndexService incomeExpenseIndexService;
	
	private IBaseDataService baseDataService;
	
	private IncomeExpenseIndex iei = new IncomeExpenseIndex();
	
	private List<BaseData> indexTypeList = new ArrayList<BaseData>();
	
	private boolean flag;
	
	public String incomeExpenseIndexManage()
	{
		indexTypeList = baseDataService.queryBaseDataByParentId("incomeExpenseType");
		lp = incomeExpenseIndexService.queryIncomeExpenseIndex(iei, pager);
		return SUCCESS;
	}
	
	public String toAddIncomeExpenseIndex()
	{
		indexTypeList = baseDataService.queryBaseDataByParentId("incomeExpenseType");
		return SUCCESS;
	}
	
	public String addIncomeExpenseIndex()
	{
		iei.setIsDel(Constant.N_INT);
		message = incomeExpenseIndexService.addIncomeExpenseIndex(iei);
		return SUCCESS;
	}
	
	public String toUpdateIncomeExpenseIndex()
	{
		indexTypeList = baseDataService.queryBaseDataByParentId("incomeExpenseType");
		iei = incomeExpenseIndexService.queryIncomeExpenseIndexById(iei.getId());
		return SUCCESS;
	}
	
	public String updateIncomeExpenseIndex()
	{
		message = incomeExpenseIndexService.updateIncomeExpenseIndex(iei); 
		return SUCCESS;
	}
	
	public String delIncomeExpenseIndex()
	{
		incomeExpenseIndexService.delIncomeExpenseIndex(iei.getId());
		return SUCCESS;
	}

	

	public List<BaseData> getIndexTypeList() {
		return indexTypeList;
	}

	public IIncomeExpenseIndexService getIncomeExpenseIndexService() {
		return incomeExpenseIndexService;
	}



	public void setIncomeExpenseIndexService(
			IIncomeExpenseIndexService incomeExpenseIndexService) {
		this.incomeExpenseIndexService = incomeExpenseIndexService;
	}



	public IncomeExpenseIndex getIei() {
		return iei;
	}



	public void setIei(IncomeExpenseIndex iei) {
		this.iei = iei;
	}



	public IBaseDataService getBaseDataService() {
		return baseDataService;
	}



	public void setBaseDataService(IBaseDataService baseDataService) {
		this.baseDataService = baseDataService;
	}



	public void setIndexTypeList(List<BaseData> indexTypeList) {
		this.indexTypeList = indexTypeList;
	}

	public boolean isFlag() {
		return flag;
	}

	public void setFlag(boolean flag) {
		this.flag = flag;
	}
	
}
